//
//  UIView+TZCategory.swift
//  SimpleTZ
//
//  Created by wangfeng on 2020/7/13.
//  Copyright © 2020 davis. All rights reserved.
//

import Foundation
import UIKit
// MARK - controller
extension UIView {
    /// view所属的控制器
    var tz_controller: UIViewController? {
        for view in sequence(first: self.superview, next: { $0?.superview }) {
            if let responder = view?.next {
                if responder.isKind(of: UIViewController.self) {
                    return responder as? UIViewController
                }
            }
        }
        return nil
    }
}
